package com.perfma.xtest.request;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class FileReadExample {
    public static void main(String[] args) {
        String fileName = "/Users/sijunhui/Downloads/log/科技个险_emp_保存日志_20240229.csv"; // 替换为你的文件路径

        try (FileReader fileReader = new FileReader(fileName)) {
            int currentChar;
            boolean isNewLine = false;

            while ((currentChar = fileReader.read()) != -1) {
                if (isNewLine) {
                    if (currentChar == '\n') {
                        System.out.println("Unix-style newline (LF)");
                    } else if (currentChar == '\r') {
                        System.out.println("Mac-style newline (CR)");
                    }
                    isNewLine = false;
                }

                if (currentChar == '\r') {
                    isNewLine = true;
                }
            }

            if (isNewLine) {
                System.out.println("Windows-style newline (CRLF)");
            }

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
